#!/usr/bin/env python3
# -*- coding=utf-8 -*-
# 题目：求一个3*3矩阵主对角线元素之和。
# 123
# 456
# 789
def f1():
    r = 0
    a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    for i in range(3):
        for j in range(3):
            if i == j or (i == 0 and j == 2) or (i == 2 and j == 0):
                r += a[i][j]
    print(r)


f = f1
if __name__ == "__main__":
    f()
